﻿using Bilibili.Common.Log;
using PCLUntils.Objects;
using System;

namespace Avalonia.BiliBili.Libs
{
    public abstract class NavigaterBase
    {
        protected static string lastView;
        protected static long lastClickTime = 0;
        protected const int TIME_INTERVAL = 2000;
        protected static bool IsNavigate(string name, long clickTime)
        {
            if (lastView.IsNotEmpty() && lastView.Equals(name, StringComparison.CurrentCultureIgnoreCase) && clickTime - lastClickTime < TIME_INTERVAL)
            {
                LogManager.Instance.LogInfo($"Stop Navigate View:{name}, LastView [{lastView}], ClickTime [{clickTime}], LastClickTime [{lastClickTime}]");
                return false;
            }
            lastView = name;
            return true;
        }
    }
}